'Generado con Version de GenCode 6.1.0.0
'Templates Version 6.1

Imports Owner.Framework.Data
Imports Owner.Framework.Data.DataFunctions
imports System.Data

Namespace Tafi.Hermes.Business
  Partial Public Class SV_SOLICITUDESXTICKETSBC

    Public Function GetAll() As SV_SOLICITUDESXTICKETSList
      Dim args As QueryArgs
      Try
        args = New QueryArgs
        args.ProcedureName = "SV_SOLICITUDESXTICKETSGetAll"

        Return GetSV_SOLICITUDESXTICKETSList(args)
      Finally
        args = Nothing
      End Try
    End Function

    Public Sub AddOne(ByVal obj As SV_SOLICITUDESXTICKETS)
      Dim args As QueryArgs
      Try
        args = New QueryArgs

        args.ProcedureName = "SV_SOLICITUDESXTICKETSAddOne"

        With obj
          args.Parameters.Add("pSXT_DETALLE", .SXT_DETALLE)
          args.Parameters.Add("pSXT_TICKET", .SXT_TICKET)
        End With

        ExecuteNonQuery(args)
      Finally
        args = Nothing
      End Try
    End Sub

    Public Sub Update(ByVal obj As SV_SOLICITUDESXTICKETS)
      Dim Args As QueryArgs
      Try
        args = New QueryArgs
        args.ProcedureName = "SV_SOLICITUDESXTICKETSUpdate"

        With obj
          args.Parameters.Add("SXT_DETALLE", .SXT_DETALLE)
          args.Parameters.Add("SXT_TICKET", .SXT_TICKET)

        End With

        ExecuteNonQuery(args)
      Finally
        args = Nothing
      End Try
    End Sub

    Public Sub Delete(ByVal SXT_DETALLE As System.Int64, ByVal SXT_TICKET As System.Int64)
      Dim Args As QueryArgs
      Try
        args = New Queryargs
        args.ProcedureName = "SV_SOLICITUDESXTICKETSDelete"

        args.Parameters.Add("SXT_DETALLE", SXT_DETALLE)
        args.Parameters.Add("SXT_TICKET", SXT_TICKET)


        ExecuteNonQuery(args)
      Finally
        args = Nothing
      End Try
    End Sub

    Private Function GetSV_SOLICITUDESXTICKETSList(ByVal Args As QueryArgs) As SV_SOLICITUDESXTICKETSList
      Dim Tabla As DataTable
      Dim objFila As DataRow
      Dim objList As SV_SOLICITUDESXTICKETSList
      Try
        objList = New SV_SOLICITUDESXTICKETSList

        Tabla = ExecuteDataTable(args)

        For Each objFila In Tabla.Rows
          objList.Add(SV_SOLICITUDESXTICKETSMapper(objFila))
        Next

        Return objList
      Catch ex As Exception
        Throw ex
      Finally
        Tabla = Nothing
        objList = Nothing
      End Try
    End Function

    Private Function SV_SOLICITUDESXTICKETSMapper(ByVal Fila As DataRow) As SV_SOLICITUDESXTICKETS
      Dim obj As SV_SOLICITUDESXTICKETS
      Try
        obj = New SV_SOLICITUDESXTICKETS
        With obj
          .SXT_DETALLE = DbNullToInt32(Fila, "SXT_DETALLE")
          .SXT_TICKET = DbNullToInt32(Fila, "SXT_TICKET")
        End With
        Return obj
      Catch ex As Exception
        Throw ex
      Finally
        obj = Nothing
      End Try
    End Function

  End Class
End Namespace